Skip to content

ci: contract reads and load, up to 61 nodes with stake-based election, scale workflow - #72

Merged
EnzinoBB merged 19 commits into
masterfrom
ci/scale-run
Oct 23, 2026
Merged

EnzinoBB merged 19 commits into
masterfrom
ci/scale-run

Conversation

@EnzinoBB

Copy link
Copy Markdown
Collaborator

Step 3 of the plan for testing smart contracts and sizing the test machine. It is stacked on #69, which is stacked on #68; the bases move to master as those PRs are merged.

contracts.py

  • Reads on every node. After the calls before and after the restart test, every node reads Counter.get and Ledger.entries as getters (TransactionFlow with forgetNewState, so no transaction is created) until it returns the expected value.
  • Reads change nothing. 20 reads on n1 must leave the contract's transaction count, its state and the master's inner id unchanged.
  • Optional load phase (--load-seconds, --write-rate, --read-rate):
    • writes come from writer accounts of their own, funded by the master key, so they do not compete with fund.py's transfers from the node accounts;
    • reads are spread over every node;
    • latencies go to contracts-stats.json;
    • a write refused by consensus (concurrent calls of one contract in a round) or by the API (the account's previous call still in progress) is counted apart, not as a fault;
    • the final counter must lie between the confirmed writes and all of them, and be the same on every node.
  • Slow executor start. Compile and deploy are retried while the node's executor is still starting.

run.sh

  • Node counts. TRUSTED_NODES: only the first N nodes are initial confidants (odd, 5 to 25), and the network can have up to 61 nodes in all.
  • Low stake. LOW_STAKE_NODES: the last K nodes get 1,000 CS, below the minimum stake. After StartingDPOS (DPOS_AT) none of them may be trusted, or the run fails.
  • Consensus report. The run prints the trusted count per round and how many nodes were trusted at least once.
  • Contract load. CONTRACT_LOAD_SECONDS, CONTRACT_WRITE_RATE and CONTRACT_READ_RATE control the load phase.
  • Executor start. With contracts, executor_check_version_delay is raised to 60 s, because dozens of JVMs starting on one machine took longer than the default 7 s and the node disabled its executor.
  • Early exit. The run fails at once when contracts.py ends before its first calls.

Workflows

  • testnet.yml:
    • nodes input from 5 to 25 (up to 61 with trusted_nodes);
    • new trusted_nodes input;
    • new contract_load input.
  • scale.yml (new): one runner per node count, each writing a summary row. It is started by a scale-* tag, scale-t<T>-n<a>_<b>[-d<sequence>][-l<K>], until it is on master.

Results (standard GitHub runner: 4 vCPU, 16 GB; all PASS)

Network Blocks/s Trusted per round CPU mean Peak RAM Writes p50 Reads p50
9 nodes, all trusted 1.83 5 4 % 1.9 GB 3.0 s 3 ms
25 nodes, all trusted 1.83 7 9 % 2.7 GB 3.3 s 3 ms
33 nodes, 7 initial trusted, 10 below the minimum stake, DPOS from block 200 1.73 7 14 % 3.7 GB 3.7 s 5 ms
51 nodes, same setup 1.67 9 21 % 4.7 GB 4.8 s 4 ms

No node below the minimum stake was trusted after DPOS. The bootstrap table is capped at 17 confidants by the 16-neighbour map.

🤖 Generated with Claude Code

EnzinoBB and others added 15 commits October 22, 2026 15:47
…to 25 nodes

- contracts.py: getters (TransactionFlow with forgetNewState: run on the node's own executor, no
  transaction) of Counter.get and Ledger.entries on every node after the calls before and after the
  restart, each node until it returns the expected value; 20 reads on n1 must leave the contract's
  transaction count, its state and the master's inner id unchanged; optional load phase
  (--load-seconds, --write-rate, --read-rate): Counter.next writes from every node's account
  through its own API and getters over every node, latency p50/p95/max in --stats-file; after it
  the counter must lie between the confirmed writes and all of them, the same on every node
- run.sh: CONTRACT_LOAD_SECONDS, CONTRACT_WRITE_RATE, CONTRACT_READ_RATE; up to 25 nodes
  (MaxTrustedNodes); the full-mesh warning is gone (initial confidants are permanent neighbours)
- testnet.yml: nodes 5 to 25, contract_load "seconds,writes,reads"; robustness.yml: nodes 5 to 25
- sampler: executor relaunches in the summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… written

A row per node count in the step summary: result, block rate, runner CPU and memory, write and
read counts and latency. Runs on a scale-* tag with the defaults (9,13,17,21,25 nodes, 120 s of
2 writes and 20 reads a second) or by hand once on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ounted apart

Several accounts calling one contract in the same round: consensus takes some calls and rejects
the others (7 nodes, 2 writes/s: 8 of 211). That is an answer, not a fault: such writes are
reported, may still land, and widen the range the final counter must lie in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…initial confidants

Only the first TRUSTED_NODES nodes are in trusted.txt; the others are ordinary nodes, as most of
mainnet, that follow the rounds and may be elected trusted later. testnet.yml and scale.yml get a
trusted_nodes input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ock in scale runs

run.sh prints the trusted count per round (n1) and how many nodes were trusted at least once.
scale.yml: dpos_at input and -d<sequence> in the tag (special order 9 moves StartingDPOS, so that
trusted nodes are elected by stake among the funded nodes, every one above the minimum stake).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e stake counts

fund.py --low-stake-nodes: the last K nodes get 1'000 CS instead of 60'000 (minimum stake 50'000).
run.sh LOW_STAKE_NODES (not initial confidants): after StartingDPOS (DPOS_AT, 100 rounds of margin)
none of them may log a TRUSTED round, or the run fails. scale.yml: low_stake_nodes input and -l<K>
in the tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat ends early fails the run

33 nodes start 33 executor JVMs at once: n1's was not reachable yet when contracts.py compiled
Counter ('Called write on non-open socket'), contracts.py exited, and run.sh waited for its ready
file until the timeout. The compile is retried on a transport error for up to 10 min, and run.sh
fails at once when contracts.py ends before its first calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…progress is not a fault

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… get 60 s to answer at start

- fund.py's transfers from the node accounts competed with the load's contract calls from the same
  accounts for inner ids (consensus rejected some transfers, 9 nodes): the load funds and uses
  accounts of its own
- 33 nodes: n1 asked its executor for its version after the default 7 s while 33 JVMs were
  starting, got none and disabled the executor for the rest of the run: executor_check_version_delay
  60 s when contracts run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/scale-run

# Conflicts:
#	.github/workflows/robustness.yml
…rs with digit groups, DPOS for low stake

- read_all and the load go to the nodes the network started with (a joining node is compared at
  the end only); 300 s for a node to read the expected value (a node killed by the crash test
  has to restart, and every executor of the machine is relaunched)
- the low-stake check reads rounds printed as R-1'234.0 and requires DPOS_AT (at most TARGET_SEQ -
  300), or it passed without checking anything
- the restart test restarts the last initial confidant by default
- scale.yml checks trusted nodes and timeout in its plan job; docs and comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB and others added 4 commits October 22, 2026 23:02
…ir states are still compared

A pruned node whose contracts' deploy blocks were pruned answers getters with status 0 and no
result (contracts-pruned-join, contracts-pruned-term-kill: n6 after pruning blocks before 1'700).
Being analysed as a node limitation; until it is fixed the reads and the load's readers leave the
pruned nodes out and say so, and the final state comparison still covers them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in progress is sent again

contracts-pruned-term-kill: two calls after the restart came back 'Transaction in progress'
(nothing accepted), so the counter ended one short on every node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ter #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnzinoBB
EnzinoBB changed the base branch from ci/contracts-robustness to master October 23, 2026 00:05
@EnzinoBB
EnzinoBB merged commit 1f556e6 into master Oct 23, 2026
45 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant